/**
 * Created by dev-001 on 2017/3/28.
 */
import bunyan from 'bunyan';
import { log } from '../config/index';

function reqSerializer(req) {
    return {
        method: req.method,
        url: req.url,
        headers: req.headers
    };
}

const logger = bunyan.createLogger({
    name: "ZXY_BE",
    serializers: {
        req: reqSerializer
    },
    streams: [
        {
            path: log.all,
        },
        {
            path: log.trace,
            level:'trace'
        },
        {
            path: log.debug,
            level: 'debug'
        },
        {
            path: log.info,
            level: 'info',
        },
        {
            path: log.warn,
            level: 'warn',
        },
        {
            path: log.error,
            level: 'error',
        },
        {
            path: log.fatal,
            level: 'fatal',
        }
    ]
});

export default logger;